package com.loan.mappers;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.loan.entity.Process;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @ClassName: ProcessMapper
 * @Description: 申请表流转过程
 * @Author: wYin
 * @Date: 2022/1/17 22:15
 */
public interface ProcessMapper extends BaseMapper<Process> {
    /**
     * 根据申请表id查找操作表,贷款申请表,客户表
     * @param
     * @return
     */
    @Select("SELECT * FROM process WHERE app_id = #{appId}")
    @Results(value = {
            @Result(id = true,property = "id",column = "id"),
            @Result(property = "appId",column = "app_id"),
            @Result(property = "empId",column = "emp_id"),
            @Result(property = "handleId",column = "handle_id"),
            @Result(property = "handle",
                    column = "handle_id",
                    one = @One(select = "com.loan.mappers.HandleMapper.selectById")),
            @Result(property = "result",column = "result"),
            @Result(property = "time",column = "time"),
    })
    List<Process> findByAppid(Integer AppId);

}
